package com.gogowan.agroenterprise.model;

import com.gogowan.agroenterprise.utils.Utils;


/**
 * 消息模型
 * 
 * @author zk
 * 
 */
public class Message {
	private  int code;
	private String data;
	private String msg;

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public String getData() {
		return data;
	}

	public void setData(String data) {
		this.data = data;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	/**
	 * 消息�?
	 */
	private MessageHead messagehead;

	/**
	 * 消息�?
	 */
	private MessageBody messagebody;

	/**
	 * 构�?消息
	 */
	public Message() {
	}

	/**
	 * 构�?消息
	 *
	 */
	public Message(int msgType, boolean isencryot, String content) {
		MessageHead head = new MessageHead(msgType, isencryot);
		setMessagehead(head);
		if(isencryot)
		{
			content=Utils.encrypt(content);
		}
		MessageBody body = new MessageBody(content);
		setMessagebody(body);
	}

	/**
	 * 得到消息�?
	 * 
	 * @return 消息�?
	 */
	public MessageHead getMessagehead() {
		return messagehead;
	}

	/**
	 * 设置消息�?
	 *
	 */
	public void setMessagehead(MessageHead newMessagehead) {
		messagehead = newMessagehead;
	}

	/**
	 * 得到消息�?
	 * 
	 * @return 消息�?
	 */
	public MessageBody getMessagebody() {
		return messagebody;
	}

	/**
	 * 设置消息�?
	 *
	 */
	public void setMessagebody(MessageBody newMessagebody) {
		messagebody = newMessagebody;
	}
}